//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.tax;

import java.io.Serializable;
import java.math.BigDecimal;

public class Tax
        implements Serializable {

    public Tax() {
    }

    public Tax(Integer id, BigDecimal taux, String updateLastTime, String userId) {
        setId(id);
        setTaux(taux);
        setUpdateLastTime(updateLastTime);
        setUserId(userId);
    }

    public Tax(Tax otherData) {
        setId(otherData.getId());
        setTaux(otherData.getTaux());
        setUpdateLastTime(otherData.getUpdateLastTime());
        setUserId(otherData.getUserId());
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setTaux(BigDecimal taux) {
        this.taux = taux;
    }

    public BigDecimal getTaux() {
        return taux;
    }

    public String getUpdateLastTime() {
        return updateLastTime;
    }

    public void setUpdateLastTime(String updateLastTime) {
        this.updateLastTime = updateLastTime;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String toString() {
        StringBuffer str = new StringBuffer("{");
        str.append("id=" + getId() + " " + "taux=" + getTaux() + " " + "updateLastTime=" + getUpdateLastTime() + " " + "userId=" + getUserId());
        str.append('}');
        return str.toString();
    }

    public boolean equals(Object pOther) {
        if (pOther instanceof Tax) {
            Tax lTest = (Tax) pOther;
            boolean lEquals = true;
            if (id == null) {
                lEquals = lEquals && lTest.id == null;
            } else {
                lEquals = lEquals && id.equals(lTest.id);
            }
            if (taux == null) {
                lEquals = lEquals && lTest.taux == null;
            } else {
                lEquals = lEquals && taux.equals(lTest.taux);
            }
            if (updateLastTime == null) {
                lEquals = lEquals && lTest.updateLastTime == null;
            } else {
                lEquals = lEquals && updateLastTime.equals(lTest.updateLastTime);
            }
            if (userId == null) {
                lEquals = lEquals && lTest.userId == null;
            } else {
                lEquals = lEquals && userId.equals(lTest.userId);
            }
            return lEquals;
        } else {
            return false;
        }
    }

    public int hashCode() {
        int result = 17;
        result = 37 * result + (id == null ? 0 : id.hashCode());
        result = 37 * result + (taux == null ? 0 : taux.hashCode());
        result = 37 * result + (updateLastTime == null ? 0 : updateLastTime.hashCode());
        result = 37 * result + (userId == null ? 0 : userId.hashCode());
        return result;
    }
    private Integer id;
    private BigDecimal taux;
    private String updateLastTime;
    private String userId;
}
